package com.juzipi.common.tools;


import lombok.Data;

import java.util.List;

/**
 * 分页结果集
 * @param <?>
 */

@Data
public class PageResult {

    private Long total;//总条数
    private Long pages;//总页数
    private List<?> records;//每页数据集合
    private String sortBy;//排序


    public PageResult(Long total, Long pages, List<?> records,String sortBy) {
        this.total = total;
        this.pages = pages;
        this.records = records;
        this.sortBy = sortBy;
    }

    public PageResult(Long total, Long pages, List<?> records) {
        this.total = total;
        this.pages = pages;
        this.records = records;
    }

    public PageResult() {
    }

    //返回分页结果集的全参构造的方法 无排序
    public static  PageResult pageResult(Long total, Long pages, List<?> records){
        return new PageResult(total,pages,records);
    }

    //有排序
    public static PageResult pageResult(Long total,Long pages,List<?> records,String sortBy){
        return new PageResult(total,pages,records,sortBy);
    }

}
